
package net.atremmedia.gwt.actionjava.examples.bounds.samples.faces;

import actionjava.display.Graphics;
import actionjava.display.Sprite;
import actionjava.geom.Color;

public abstract class Face extends Sprite
{
	protected void draw(String path)
	{
		try {
			Graphics graph = getGraphics();
			graph.beginFill(getRandomColor());
			graph.decodePath(path);
			graph.closePath();

		} catch (Exception e) {
			e.printStackTrace();
		}

		setRegX(-(getWidth() / 2));
		setRegY(-(getHeight() / 2));
	}

	public double getRandomNumber(double min, double max)
	{
		return Math.floor(Math.random() * (max - min + 1) + min);
	}

	public String getRandomColor()
	{
		return Color.getRGB(Double.valueOf(getRandomNumber(0, 16581375)).intValue());
	}
}
